{extend name="base" /}
<!-- page specific plugin styles -->
{block name="inline-styles"}
{/block}
<!-- PAGE CONTENT BEGINS -->
{block name="content"}
<div class="page msg_success js_show">
    <div class="weui-msg">
        <div class="weui-msg__icon-area"><i class="fa fa-weixin weui-icon_msg"></i></div>
        <div class="weui-msg__text-area">
            <h2 class="weui-msg__title">操作说明</h2>
            <p class="weui-msg__desc">1.未绑定微信账号的直接点击“绑定微信”即可完成绑定！</p>
            <p class="weui-msg__desc">2.绑定过微信的账号需要先点击“解除绑定”，输入当前账号密码完成解除绑定，然后再按照上一步骤绑定微信即可！</p>
            <p class="weui-msg__desc">注：绑定完成后需要重新登录账号！</p>

        </div>
        <div class="weui-msg__opr-area">
            <p class="weui-btn-area">
                {if condition="$has_bind"}
                <a href="javascript:;" class="weui-btn weui-btn_warn" id="showToast">解除绑定</a>
                {else}
                <a href="{$url}" class="weui-btn weui-btn_primary">绑定微信</a>
                {/if}
            </p>
        </div>
        <div class="weui-msg__extra-area">
            <div class="weui-footer">
                <p class="weui-footer__links">
                    <a href="javascript:void(0);" class="weui-footer__link">米粒生活</a>
                </p>
                <p class="weui-footer__text">Copyright © 2008-2018 mlilife.com</p>
            </div>
        </div>
    </div>
</div>
{/block}
<!-- PAGE CONTENT ENDS -->
<!-- inline scripts related to this page -->
{block name="related-scripts"}
<script type="text/javascript">
    $("#showToast").click(function(event) {
        $.ajax({
            url: '/mobile/index/unbind',
            type: 'GET',
            dataType: 'json',
        })
        .done(function(json) {
            if(json.returnCode==1){
                $.toast("解除成功", function() {
                    window.location.reload();
                });
            }else{
                $.toptip(json.returnMsg, 'error');
            }
        })
        .fail(function() {
            console.log("error");
        })
        .always(function() {
            console.log("complete");
        });
    });
</script>
{/block}